package com.biboheart.sc.support.utils;

import com.biboheart.sc.support.definition.CharType;

public class LetterUtils {
    public static CharType getCharType(char ch) {
        CharType charType;
        if (ch == 0) {
            charType = CharType.CHAR_TYPE_EOF;
        } else if (ch == 32 || ch == 9 || ch == 10 || ch == 13) { // 空格
            charType = CharType.CHAR_TYPE_SPACE;
        } else if ((ch > 64 && ch < 91) || (ch > 96 && ch < 123)) {
            charType = CharType.CHAR_TYPE_LETTER;
        } else if (ch >= 48 && ch <= 57) {
            charType = CharType.CHAR_TYPE_NUMBER;
        } else if (ch == 46) { // .
            charType = CharType.CHAR_TYPE_DOT;
        } else if (ch == 44) { // 逗号
            charType = CharType.CHAR_TYPE_COMMA;
        } else if (ch == 34) {
            charType = CharType.CHAR_TYPE_DQUOTES;
        } else if (ch == 39) {
            charType = CharType.CHAR_TYPE_SQUOTES;
        } else if (ch == 95) {
            charType = CharType.CHAR_TYPE_UNDERLINE;
        } else if (ch == 96) {
            charType = CharType.CHAR_TYPE_BACKQUOTE;
        } else if (ch == 40) {
            charType = CharType.CHAR_TYPE_LB;
        } else if (ch == 41) {
            charType = CharType.CHAR_TYPE_RB;
        } else if (ch == 91) {
            charType = CharType.CHAR_TYPE_LSB;
        } else if (ch == 93) {
            charType = CharType.CHAR_TYPE_RSB;
        } else if (ch == 123) {
            charType = CharType.CHAR_TYPE_LCB;
        } else if (ch == 125) {
            charType = CharType.CHAR_TYPE_RCB;
        } else if (ch == 43) {
            charType = CharType.CHAR_TYPE_PLUS;
        } else if (ch == 45) {
            charType = CharType.CHAR_TYPE_MINUS;
        } else if (ch == 42) {
            charType = CharType.CHAR_TYPE_ASTERISK;
        } else if (ch == 47) {
            charType = CharType.CHAR_TYPE_SLASH;
        } else {
            charType = CharType.CHAR_TYPE_OTHER;
        }
        return charType;
    }
}
